//
//  XTComposeViewController.swift
//  HrenryWeibo
//
//  Created by 熊涛 on 16/5/23.
//  Copyright © 2016年 熊涛. All rights reserved.
//

import UIKit
import SVProgressHUD

class XTComposeViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        self.view.backgroundColor = UIColor.greenColor()
        
        //添加item
        prepareItem()
        
    }

    
    //MARK: - 添加item
    //添加item
    private func prepareItem() {
    
        //左边
        self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "取消", style: UIBarButtonItemStyle.Plain, target: self, action: "cancel")
        
        //右边
        self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "发送", style: UIBarButtonItemStyle.Plain, target: self, action: "send")
        
        //设置导航栏标题
        setTitleView()
    }
    
    //设置导航栏标题
    private func setTitleView() {
    
        let prefix = "发微博"
        
        //创建label
        let label = UILabel()
        
        //设置属性
        label.textColor = UIColor.blackColor()
        label.font = UIFont.systemFontOfSize(13)
        label.textAlignment = NSTextAlignment.Center
        label.numberOfLines = 0
        
        label.text = prefix + "\n" + "hh"
        label.sizeToFit()
        
        self.navigationItem.titleView = label
        
    }
    
    
    
    //MARK: - item点击事件
    //左边 取消 按钮
    @objc private func cancel() {
    
        dismissViewControllerAnimated(true, completion: nil)
    }

    //右边 发送 按钮
    @objc private func send() {
        
        SVProgressHUD.showSuccessWithStatus("点击发送按钮")
        
    }
    



}
